import api from "../utils/request.js"
const userApi={
    PostInformation: (UserDetail) => {
        return api.post('userDetail/selfData',UserDetail)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    GetInformation: () => {
        return api.get('userDetail/detailId')
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    CheckExist: () => {
        return api.post('userDetail/checkExist')
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    GetPhoto: () => {
        return api.get('userDetail/photo')
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    InsertProduct: (ProductDetail) => {
        return api.post('productDetail/post',ProductDetail)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    GetSelfProduct:()=>{
        return api.get('productDetail/GetBYUserId')
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    ChangeProductNumber:(ProductDetail)=>{
        return api.put('productDetail/ChangeNumber',ProductDetail)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    deleteProductDetailById: (id) => {
        return api.delete(`productDetail/${id}`)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    InsertFeedback: (feedback) => {
        return api.post('feedback/post',feedback)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    IsUserDetailExist:()=>{
        return api.get('userDetail/detailId')
            .then(response=>response.data)
            .catch(error=>{
                console.log(error);
                return null;
            })
    },
    getSelfFeedDate:()=>{
        return api.get('feedback/selfData')
            .then(response=>response.data)
            .catch(error=>{
                console.log(error);
                return null;
            })
    },
    DeleteFeedBackBYId: () => {
        return api.delete(`feedback/selfFeedback`)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    DeleteProductBYSelfId: () => {
        return api.delete('userDetail/self')
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    getAllProductNumber:()=>{
        return api.get('product/product')
            .then(response=>response.data)
            .catch(error=>{
                console.log(error);
                return null;
            })
    },
    getAllProductPrice:()=>{
        return api.get('product/productPrice')
            .then(response=>response.data)
            .catch(error=>{
                console.log(error);
                return null;
            })
    },
    getAllPeopleNumber:()=>{
        return api.get('userDetail/people')
            .then(response=>response.data)
            .catch(error=>{
                console.log(error);
                return null;
            })
    },
    //下面这些就是关于那个反馈信息的了
    ChangePassword: (params) => {
        return api.request({
            method:'post',
            url:'user/ChangePassword',
            data:params
        })
    },
}
export default  userApi
